<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <head>
        <meta charset="UTF-8">
        <title>欢迎页面-X-admin2.0</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
        <link rel="stylesheet" href="./css/font.css">
        <link rel="stylesheet" href="./css/xadmin.css">
        <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
        <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="./js/xadmin.js"></script>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
        <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
        <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <script th:src="@{/js/jquery-1.8.3.js}"></script>
        <![endif]-->
    </head>
</head>
<body onload="ss()">
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">购买</a>
        <a><cite>批量提交</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" method="POST" action="#" th:action="@{/buy}" th:object="${buy}" enctype="multipart/form-data" onsubmit="return check()">
            <p>
                <input type="text" class="layui-input" id="name" name="name" th:field="*{Name}" readonly="readonly" style="display:none" />
                商品编号: <input class="layui-input" type="text" name="ProductID" th:field="*{ProductID}"/>
                充值数量: <input class="layui-input" type="text" name="BuyAmount" th:field="*{BuyAmount}"/>
                号码文件：<input type="file"  name="file" id="file"/>
                <input  class="layui-btn" type="submit" value="提交"/>
                <input  class="layui-btn" type="button" value="清空" onclick="but()"/>
            </p>
        </form>
    </div>
    <table class="layui-table">
        <thead>
        <tr align="center">
           <!-- <th>
                <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
            </th>-->
            <th align="center">充值账号</th>
            <th align="center">充值数量</th>
            <th align="center">提交结果</th>
            <th align="center">提交时间</th>
            <th align="center">商家账号</th>
        </tr>
        </thead>
        <tbody>
        <tr align="center" th:each="al : ${arrayList}">
           <!-- <td>
                <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='2'><i class="layui-icon">&#xe605;</i></div>
            </td>-->
            <td th:text="${al.account}">${al.account}</td>
            <td th:text="${al.amount}">${al.amount}</td>
            <td th:text="${al.result}">${al.result}</td>
            <td th:text="${al.datetime}">${al.datetime}</td>
            <td th:text="${al.buynum}">${al.buynum}</td>
        </tr>
        </tbody>
    </table>
<script>
    var _hmt = _hmt || []; (function() {
    var hm = document.createElement("script");
    hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();
</script>
<script th:inline="javascript" type="text/javascript">
    function ss() {
        var xx=[[${session.user.name}]];
        if("" == xx || null == xx){
            alert("没有登陆，请重新登陆")
            window.location.href="/login"
        }else {
           $("#name").val(xx);
        }
    }
    function check() {
        if($("input[name='MerchantID']").val()==""){
            alert("商家编号不能为空");
            return false;
        }
        else if($("input[name='ProductID']").val()==""){
            alert("商品编号不能为空");
            return false;
        }
        else if($("input[name='BuyAmount']").val()==""){
            alert("充值数量不能为空");
            return false;
        }
        else if($("input[name='Key']").val()==""){
            alert("商家密钥不能为空");
            return false;
        }
        else if($(" input[name='file'] ").val()==""){
            alert("文件没有选中");
            return false;
        }else {
            return true;
        }
    }
    function but() {
        $(" input[name='TargetAccount'] ").val("");
        $("input[name='ProductID']").val("");
        $("input[name='BuyAmount']").val("")
    }
</script>
</body>
</html>